package com.dubito.composewidgets.ui.bottomnavigation

import androidx.navigation.NavGraph.Companion.findStartDestination
import androidx.navigation.NavHostController

/**
 * author: LiLiang
 * createTime: 2022/10/5-10:22
 * remark:
 **/

// 定义目的地
object Destinations {
    const val HOME = "home"
    const val BOOKMARKS = "bookmarks"
    const val NOTIFICATION = "notification"
}

class NavigationActions(private val navHostController: NavHostController) {
    fun navigate(route: String) {
        navHostController.navigate(route = route) {
            popUpTo(navHostController.graph.findStartDestination().id) {
                saveState = true
            }
            launchSingleTop = true
            restoreState = true
        }
    }
}